﻿using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        // 创建一个优先级队列
        var priorityQueue = new PriorityQueue<int, int>();

        // 向队列中添加元素及其优先级
        priorityQueue.Enqueue(3, 2);
        priorityQueue.Enqueue(1, 3);
        priorityQueue.Enqueue(4, 1);

        // 出队操作，每次都会移除并返回优先级最高的元素
        while (priorityQueue.TryDequeue(out var dequeuedItem, out var _))
        {
            Console.WriteLine($"Dequeued item with priority: {dequeuedItem}");
        }
    }
}